Skip to content

Conversation

@brukew
Copy link

@brukew brukew commented Dec 24, 2025

No description provided.

@brukew brukew merged commit fa1f8ce into vlm-baseline Dec 24, 2025
2 of 6 checks passed
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @brukew, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes a robust baseline evaluation framework for Video-Language Models (VLMs), focusing on automating video annotation tasks. It integrates the Ovis2 model, introduces a modular architecture for model interaction, evaluation, and postprocessing, and provides configurable settings for various annotation types. The changes aim to streamline the process of applying and assessing VLMs for tasks like activity descriptions and gesture classifications in video data.

Highlights

  • Python Version Update: The required Python version in pyproject.toml has been updated to >=3.11,<3.13, indicating a move towards newer Python features and environments.
  • New VLM Baseline Framework: A new vlm_baseline package and directory structure have been introduced, providing a foundational framework for automatic video annotation using Video-Language Models (VLMs).
  • Ovis2 Model Integration: The Ovis2 VLM has been integrated into the new framework, complete with a dedicated model wrapper, base class, and factory function for standardized interaction.
  • New Dependencies Added: Several new Python dependencies, including decord, pillow, torch, transformers, scikit-learn, and moviepy, have been added to support the VLM functionalities.
  • Configurable Annotation Tasks: Multiple YAML configuration files have been added for Ovis2, enabling the definition and execution of various annotation tasks such as activity description, gesture classification, and social interaction analysis.
  • Evaluation and Postprocessing Modules: New modules for evaluation metrics (metrics.py) and postprocessing validation (validation.py) have been added to support robust assessment and refinement of VLM outputs.
  • Comprehensive Documentation: Detailed documentation (documentation.md) has been added to guide users on the VLM Baseline Evaluation framework, including how to run experiments and integrate new models.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a baseline framework for video annotation using the Ovis2 VLM. The overall structure is well-organized, with clear separation of concerns for models, evaluation, and configuration. The code is generally clean and includes good practices like robust error handling in video processing and detailed output artifacts for reproducibility. My review focuses on improving dependency management, configuration portability, and some areas for code refinement and extensibility. The most critical issue is the use of non-existent package versions in pyproject.toml, which will prevent installation.

Comment on lines +45 to +47
torch = "^2.9.1"
transformers = "^4.57.3"
scikit-learn = "^1.8.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The versions specified for torch, transformers, and scikit-learn appear to be non-existent future versions. This will cause dependency resolution to fail during installation. Please update them to valid, existing versions. You can check PyPI for the latest stable versions.

Suggested change
torch = "^2.9.1"
transformers = "^4.57.3"
scikit-learn = "^1.8.0"
torch = "^2.3.1"
transformers = "^4.41.2"
scikit-learn = "^1.5.0"

max_frames: 16

data:
ground_truth_csv: /orcd/scratch/bcs/001/sensein/sails/BIDS_data/test.csv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This configuration file contains a hardcoded absolute path for ground_truth_csv. The save_dir on line 20 is also hardcoded. This makes the code non-portable and difficult to run in different environments. Consider using environment variables or making paths relative to a configurable root directory. This issue is present in all newly added YAML configuration files.

from .ovis2 import Ovis2VLM


def load_model(model_config: Dict[str, Any]) -> Ovis2VLM:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The return type hint is Ovis2VLM. This should be the base class BaseVLM to allow this factory to return different VLM implementations in the future without needing to change the function signature. You will need to add from .base_vlm import BaseVLM at the top of the file.

Suggested change
def load_model(model_config: Dict[str, Any]) -> Ovis2VLM:
def load_model(model_config: Dict[str, Any]) -> "BaseVLM":

Comment on lines +81 to +85
out: Dict[str, Any] = {"n": int(len(predictions_df))}

# Example: just track average length
if "avg_len" in metrics:
out["avg_len"] = float(predictions_df["prediction"].fillna("").map(len).mean())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The int() and float() casts here are redundant. len() already returns an integer, and .mean() on a pandas Series typically returns a float.

Suggested change
out: Dict[str, Any] = {"n": int(len(predictions_df))}
# Example: just track average length
if "avg_len" in metrics:
out["avg_len"] = float(predictions_df["prediction"].fillna("").map(len).mean())
out: Dict[str, Any] = {"n": len(predictions_df)}
# Example: just track average length
if "avg_len" in metrics:
out["avg_len"] = predictions_df["prediction"].fillna("").map(len).mean()

Comment on lines +60 to +62
### How to add a new model

## How to Add a New Model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a duplicate section header here. Line 60 has ### How to add a new model and line 62 has ## How to Add a New Model. One of them should be removed to avoid confusion.

Suggested change
### How to add a new model
## How to Add a New Model
## How to Add a New Model

Comment on lines +17 to +18
if name == "ovis2":
return Ovis2VLM(model_config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This factory pattern using if/elif statements requires modifying this file every time a new model is added. For better extensibility, consider a registration mechanism, such as using entry points or a dictionary of registered models, to allow adding new models without changing the core library code.


# --- Frame extraction (keep here for now; move later if you want) ---

def _extract_frames(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The _extract_frames method is very long and handles logic for three different video reading backends (decord, opencv, moviepy). To improve readability and maintainability, consider refactoring this into smaller, dedicated functions for each backend, e.g., _extract_frames_decord, _extract_frames_opencv, etc. The main method could then try them in sequence.


# 1) decord
try:
from decord import VideoReader, cpu # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The import from decord import VideoReader, cpu is located inside the _extract_frames method. It's generally better to place imports at the top of the file for clarity, to avoid repeated import attempts, and to make dependencies explicit. This also applies to the import cv2 on line 249. If these are optional dependencies, you can wrap the top-level import in a try...except ImportError block.

Comment on lines +170 to +174
if pred_label is None:
pred_label = INVALID_LABEL

if str(pred_label) == INVALID_LABEL:
invalid_preds += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block can be simplified. The validate_classification_output function is guaranteed to return a string, so the if pred_label is None: check is redundant. Additionally, pred_label is already a string, so str(pred_label) is also redundant.

Suggested change
if pred_label is None:
pred_label = INVALID_LABEL
if str(pred_label) == INVALID_LABEL:
invalid_preds += 1
if pred_label == INVALID_LABEL:
invalid_preds += 1

Comment on lines +271 to +275
import sys

if len(sys.argv) < 2:
raise SystemExit("Usage: python -m runners.run_experiment path/to/config.yaml")
main(sys.argv[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are a couple of minor issues here:

  1. import sys on line 271 is redundant, as sys is already imported at the top of the file (line 7).
  2. The usage message on line 274 is a bit confusing. It refers to run_experiment, but the script is run_prediction.py. A clearer message would be helpful.
    if len(sys.argv) < 2:
        raise SystemExit("Usage: python vlm_baseline/runners/run_prediction.py <path_to_config.yaml>")
    main(sys.argv[1])

@lucie271 lucie271 deleted the ovis2-baseline branch January 5, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant